最近复现代码的时候,需要安装Dlib的Python库,本以为pip就可以解决这个问题,结果出现了如下的错误:
[ 79%] Built target dlib
Scanning dependencies of target dlib_python
[ 79%] Building CXX object CMakeFiles/dlib_python.dir/src/matrix.cpp.o
[ 80%] Building CXX object CMakeFiles/dlib_python.dir/src/dlib.cpp.o
[ 81%] Building CXX object CMakeFiles/dlib_python.dir/src/vector.cpp.o
[ 82%] Building CXX object CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o
[ 83%] Building CXX object CMakeFiles/dlib_python.dir/src/svm_rank_trainer.cpp.o
[ 83%] Building CXX object CMakeFiles/dlib_python.dir/src/decision_functions.cpp.o
[ 84%] Building CXX object CMakeFiles/dlib_python.dir/src/other.cpp.o
[ 85%] Building CXX object CMakeFiles/dlib_python.dir/src/basic.cpp.o
[ 86%] Building CXX object CMakeFiles/dlib_python.dir/src/cca.cpp.o
[ 86%] Building CXX object CMakeFiles/dlib_python.dir/src/sequence_segmenter.cpp.o
[ 87%] Building CXX object CMakeFiles/dlib_python.dir/src/svm_struct.cpp.o
[ 88%] Building CXX object CMakeFiles/dlib_python.dir/src/image.cpp.o
[ 89%] Building CXX object CMakeFiles/dlib_python.dir/src/image2.cpp.o
[ 90%] Building CXX object CMakeFiles/dlib_python.dir/src/image3.cpp.o
[ 90%] Building CXX object CMakeFiles/dlib_python.dir/src/image4.cpp.o
[ 91%] Building CXX object CMakeFiles/dlib_python.dir/src/rectangles.cpp.o
[ 92%] Building CXX object CMakeFiles/dlib_python.dir/src/object_detection.cpp.o
[ 93%] Building CXX object CMakeFiles/dlib_python.dir/src/shape_predictor.cpp.o
[ 93%] Building CXX object CMakeFiles/dlib_python.dir/src/correlation_tracker.cpp.o
[ 94%] Building CXX object CMakeFiles/dlib_python.dir/src/face_recognition.cpp.o
[ 95%] Building CXX object CMakeFiles/dlib_python.dir/src/cnn_face_detector.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-7/README.Bugs for instructions.
CMakeFiles/dlib_python.dir/build.make:518: recipe for target ‘CMakeFiles/dlib_python.dir/src/face_recognition.cpp.o’ failed
make[2]: [CMakeFiles/dlib_python.dir/src/face_recognition.cpp.o] Error 4
make[2]: Waiting for unfinished jobs….
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/dlib_python.dir/all’ failed
make[1]: [CMakeFiles/dlib_python.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: [all] Error 2
Traceback (most recent call last):
File “setup.py”, line 257, in
‘Topic :: Software Development’,
File “/home/songe/lip_reading/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/setuptools/init.py”, line 129, in setup
File “/usr/lib/python3.6/distutils/core.py”, line 148, in setup
dist.run_commands()
File “/usr/lib/python3.6/distutils/dist.py”, line 955, in run_commands
self.run_command(cmd)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/home/songe/lip_reading/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/setuptools/command/install.py”, line 67, in run
File “/home/songe/lip_reading/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/setuptools/command/install.py”, line 109, in do_egg_install
File “/usr/lib/python3.6/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/home/songe/lip_reading/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/setuptools/command/bdist_egg.py”, line 172, in run
File “/home/songe/lip_reading/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/setuptools/command/bdist_egg.py”, line 158, in call_command
File “/usr/lib/python3.6/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/home/songe/lip_reading/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/setuptools/command/install_lib.py”, line 11, in run
File “/usr/lib/python3.6/distutils/command/install_lib.py”, line 109, in build
self.run_command(‘build_ext’)
File “/usr/lib/python3.6/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “setup.py”, line 133, in run
self.build_extension(ext)
File “setup.py”, line 173, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File “/usr/lib/python3.6/subprocess.py”, line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘–build’, ‘.’, ‘–config’, ‘Release’, ‘–’, ‘-j2’]’ returned non-zero exit status 2.
在网上查的主流解决方法是检查Python、Python-dev的版本匹配的问题,有人是安装了Python3-dev就可以了。但是我的问题一直没有解决,偶然查到了一个issue:[c++: internal compiler error: Killed (program cc1plus) ](https://github.com/Valloric/ycmd/issues/224).
micbou说这是memory的问题,我把自己的虚拟机Memory调到了3.6G,编译的进度从85%崩变成了96%崩了。最后确定就是Memory不足的问题,调成4G的Memory以后就解决了这个困扰我两天的坑=.=